package com.rxyb.security.handler;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken;
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author YJH
 * @version 1.0
 * @description ，在用户登陆一次以后，系统会记住用户一段时间，在这段时间，用户不用反复登陆
 * @date 2020/5/16  16:31
 */
@Component
public class RememberMeHandler implements PersistentTokenRepository {

    /**
     * token 有效期30天
     */
    private static final Long TOKEN_VALUE_DAYS = 15L;

    @Autowired
    private StringRedisTemplate stringRedisTemplate;



    @Override
    public void createNewToken(PersistentRememberMeToken token) {

    }

    @Override
    public void updateToken(String series, String tokenValue, Date lastUsed) {

    }

    @Override
    public PersistentRememberMeToken getTokenForSeries(String seriesId) {
        return null;
    }

    @Override
    public void removeUserTokens(String username) {

    }
}
